/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import View.Vista;
import View.Vista;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Controller {

    static private String user, pass, host;
    static private int port = 21;
    static ClientFTP client;
    static Vista vista;

    public static Vista getVista(){
        return vista;
    }
    
    public static ClientFTP getClient() {
        return client;
    }

    public static void main(String[] args) {
        //pruebaCon();
        vista = new Vista();
        vista.setVisible(true);
//        connect();

        //disconnect();
    }
    
    public static void setParameters(String host, String user, String pass){
        Controller.user = user;
        Controller.host = host;
        Controller.pass = pass;
        //System.out.println("La conexion es ahora: " + host + user + pass);
    }

    public static void connect() {
//        user = "u618667591";
//        pass = "password";
//        host = "valdocco.hol.es";
        client = new ClientFTP();
        client.connect(host, port);
        client.login(user, pass);
        vista.reloadVista();
    }

    public static void print(String in) {
        vista.print(in);
    }

    public static void disconnect() {
        client.logout();
        client.disconnect();
    }

    public static void pruebaCon() {
        user = "u618667591";
        pass = "password";
        host = "valdocco.hol.es";
        client = new ClientFTP();
        client.connect(host, port);
        client.login(user, pass);

        //client.download("default.php", "pepitofault.php");
        //client.upload("olakase.TXT", "olakase.TXT"); //No funciona, no da fallo pero sube nada.
//        client.createRemoteDir("FUCK");
//        client.changeDir("FUCK");
//        client.showRemoteFilesHere();
//        client.changeDir("..");
//        client.showRemoteFilesHere();
//        client.removeRemoteDir("FUCK");
//        client.showRemoteFilesHere();
        client.logout();
        client.disconnect();
        client.showLocalFilesHere();
    }
}
